
function killTorrent(id) {
    var req = new XMLHttpRequest();
    s=getInfo(id);
    statuses['paused'][id]=s;
    for (var k in statuses['running'][id]) 
        if (k!='toJSONString') 
            statuses['paused'][id][k]=statuses['running'][id][k];
    delete statuses['running'][id];
    req.open('GET',"http://localhost:"+PORT+"/kill/?id="+id,false);
    req.send(null);
    return req.responseText;
}
function sendOneTorrent(dl_dest,torrent_file) {
    get_url="http://localhost:"+PORT+"/torrent_file/?torrent="+encodeURIComponent(torrent_file)+"&save_path="+encodeURIComponent(dl_dest);
    var req = new XMLHttpRequest();
    req.open('GET', get_url, false); 
    req.send(null);
    if(req.status == 200)
        tor=req.responseText.parseJSON();
        statuses['running'][tor['id']]={'dl_dest':dl_dest,'torrent_file':torrent_file};
}
